<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<!-- <el-form-item>
					<el-input v-model="filters.name" placeholder="设备IP"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary">查询</el-button>
				</el-form-item> -->
			</el-form>
		</el-col>

		<!--列表-->
		<el-table :data="cardList" highlight-current-row v-loading="listLoading" style="width: 100%;" :height="clientHeight" >
			<el-table-column prop="system_datetime" label="制卡时间" width="80">
			</el-table-column>
			<el-table-column prop="computer_name" label="计算机名称" width="90">
			</el-table-column>
			<el-table-column prop="ic_print_code" label="IC卡印刷编号" width="100">
			</el-table-column>
			<el-table-column prop="ic_id" label="IC卡卡号" width="80">
			</el-table-column>
			<el-table-column prop="have_sfz_desc" label="是否有身份证" width="90">
			</el-table-column>
			<el-table-column prop="sfzinfo_type_desc" label="身份证信息获取方式" width="120">
			</el-table-column>
			<el-table-column prop="sfz_number" label="身份证号码" width="130">
			</el-table-column>
			<el-table-column label="身份证司机图片保存路径" width="170">
				<template slot-scope="scope">
					<img class="scope-img id-img" @click="isZoom(scope.row.sfz_photo_path + '/' + scope.row.sfz_photo_filename)" :src="scope.row.sfz_photo_path + '/' + scope.row.sfz_photo_filename">
				</template>
			</el-table-column>
			<el-table-column prop="sfz_photo_filename" label="身份证司机图片保存名称" width="150">
			</el-table-column>
			<el-table-column prop="remarks" label="备注">
			</el-table-column>
		</el-table>

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination
				layout="prev, pager, next"
				@current-change="handleCurrentChange"
				:total="total"
				style="float:right;">
			</el-pagination>
		</el-col>

		<!-- 图片放大 -->
		<el-dialog title="展示图片" v-model="is_zoom_img" class="zoom-img-dialog" :close-on-click-modal="false">
			<img class="zoom_img_id" :src="zoom_img">
		</el-dialog>
	</section>
</template>

<script>
	import { icRecord } from '@/api/api';
    import { mapState } from 'vuex'
	export default {
		data() {
			return {
				filters: {
					name: ''
				},
				cardList: [],
				total: 0,
				page: 1,
				listLoading: false,
				is_zoom_img: false,
				zoom_img: '',
			}
		},
        computed: {
            ...mapState(
                {
                  'clientHeight': state => state.clientHeight
                }
            )
        },
		methods: {
			router(path) {
				this.$router.push(path)
			},
			handleCurrentChange(val) {
				this.page = val;
				this.ic_record();
			},
			//获取设备警报信息
			ic_record() {
				this.listLoading = true;
				icRecord(this.page).then((res) => {
					this.total = res.data.data.total
					this.cardList = res.data.data.data
					this.listLoading = false
				});
			},
			isZoom(imgSrc) {
				this.zoom_img = imgSrc
				this.is_zoom_img = !this.is_zoom_img
			}
		},
		mounted() {
			this.ic_record();
		}
	}

</script>

<style scoped>
	.id-img.scope-img{object-fit: contain;}
	.zoom-img-dialog .el-dialog .zoom_img_id{width: 340px;position: relative;left: 50%;margin-left: -170px;object-fit: contain;height: auto;}
</style>